const app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    EMPLOYEE_NAME:'',//姓名
    EMPLOYEE_PASSWORD:'',//密码
    result:'',//注册的账号
    work:'',//工号
  },


  // 61006587
  // 307984

  // 61014135
  // 203019
//登录接口
  login_a:function(){
          wx.request({
           url:app.globalData.interface+'/weinanpost/WeiNanPostAPI_1001_EmployeeLogo', 
           method:'POST',
            data: {
              EMPLOYEE_NAME:this.data.EMPLOYEE_NAME,
              EMPLOYEE_PASSWORD:this.data.EMPLOYEE_PASSWORD,
              OPEN_ID: this.data.openid, //用户OPEN_ID
              session_key:this.data.session_key,
              OPEN_UUID:this.data.jiami
            },
            header:{
              'content-type':'application/x-www-form-urlencoded'
            },
            success:res=> {
              console.log(res)
              console.log(res.data.data.EMPLOYEE_ID)
              //员工工号
              let mealsList = res.data.data.EMPLOYEE_ID;
              app.globalData.mealsList = mealsList;
              
              let UUIDSTRING = res.data.data.UUIDSTRING;
              app.globalData.UUIDSTRING = UUIDSTRING;
              
              var gonghao = res.data.data.EMPLOYEE_ID
              this.setData({
                work:gonghao
              })
              console.log(this.data.work);

             res.data.result
              if( res.data.result == "error"){
                wx.showModal({
                  title: '温馨提示',
                  content: '请输入正确的账号或密码',
                  success: function (res) {
                    if (res.confirm) {//这里是点击了确定以后
                      console.log('用户点击确定')
                    } else {//这里是点击了取消以后
                      console.log('用户点击取消')
                    }
                  }
                })
              }else{//带工号跳转
                wx.navigateTo({
                  url: '../../pages/weinanyuangongtiaozhuanye/weinanyuangongtiaozhuanye?data='+this.data.work
                })
              }
            }
          })
    // }
    },

    // word_shang(){
    //   wx.navigateTo({
    //     url: '../../pages/shangxiu/shangxiu'
    //   })
    // },

    onLoad:function (options) {
      this.setData({
   
           
        openid: app.globalData.openid,
        jiami: app.globalData.jiami,
        OPEN_ID: app.globalData.openid,
        session_key: app.globalData.session_key,
      })
    },


})